package org.biliviz.be.controller;

import io.swagger.annotations.ApiOperation;
import org.biliviz.be.entity.*;
import org.biliviz.be.entity.vo.ChannelCount;
import org.biliviz.be.service.*;
import org.biliviz.be.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sg
 * @since 2024-02-20
 */
@RestController
@RequestMapping("/api")
public class VideoTopController {
    @Autowired
    VtChannelCountService vtChannelCountService;

    @ApiOperation(value = "标签")
    @GetMapping("vtcc")
    public R vtcc() {

        List<VtChannelCount> Vtcc= vtChannelCountService.getAll();
        List<VtChannelCount> vtChannelCountTop100= vtChannelCountService.getTop100();
        return R.ok().data("vtcc",Vtcc)
                .data("vtcct100",vtChannelCountTop100);
    }

    @Autowired
    VtScoreDurationService vtScoreDurationService;

    @ApiOperation(value = "标签")
    @GetMapping("vtsd")
    public R vtsd() {

        List<VtScoreDuration> Vtsd= vtScoreDurationService.getAll();
        return R.ok().data("vtsd",Vtsd);
    }

    @Autowired
    VtScoreLfcService vtScoreLfcService;

    @ApiOperation(value = "标签")
    @GetMapping("vtslfc")
    public R vtslfc() {

        List<VtScoreLfc> Vtslfc= vtScoreLfcService.getAll();
        return R.ok().data("vtslfc",Vtslfc);
    }

    @Autowired
    VtScoreTopService vtScoreTopService;

    @ApiOperation(value = "标签")
    @GetMapping("vtst")
    public R vtst() {
        List<VtScoreTop> Vtst= vtScoreTopService.getAll();
        return R.ok().data("vtst",Vtst);
    }

//    分区视频
@GetMapping("video/top/channel")
public R vtcgame(@RequestParam String channel) {
    List<VtScoreTop> vtc_st = vtScoreTopService.getChannelST(channel);
    List<VtScoreDuration> vtc_sd = vtScoreDurationService.getChannelSD(channel);
    List<VtScoreLfc> vtc_slfc = vtScoreLfcService.getChannelLFC(channel);
    List<ChannelCount> vtc_cc = vtChannelCountService.getChannelCC(channel);
    return R.ok().
            data("vtc_st", vtc_st).
            data("vtc_sd",vtc_sd).
            data("vtc_slfc",vtc_slfc).
            data("vtc_cc",vtc_cc);
}
}
